package com.fenshi.interactor.imp;

import android.content.Context;

import com.alibaba.fastjson.JSONObject;
import com.android.volley.VolleyError;
import com.fenshi.interactor.RentOrBackInteractor;
import com.fenshi.presenter.listener.RequestListener;
import com.fenshi.until.MethodCode;
import com.fenshi.until.MethodType;
import com.quickdv.helper.NetWorkImp;

/**
 * Created by Administrator on 2015/10/14.
 */
public class RentOrBackInteractorImp extends NetWorkImp implements RentOrBackInteractor {

    RequestListener<JSONObject> listener;

    public RentOrBackInteractorImp(Context c,RequestListener<JSONObject> listener) {
        super(c);
        this.listener = listener;
    }


    @Override
    protected void onRequestSuccess(Object tag, JSONObject result) {
        JSONObject response = result.getJSONObject(MethodCode.responseContent_key);
        int statue = response.getInteger(MethodCode.responseStatue);

        if (statue == (MethodCode.NetState.SUCCESS.getValue())) {

            if (tag.toString().equals(MethodType.LOGIN)) {
                JSONObject obj = response.getJSONObject(MethodCode.OBJECT);
            } else if(tag.toString().equals(MethodType.LOGIN)){

            }

        }
        listener.Error(tag + "", "用户名密码错误");
    }

    @Override
    protected void onRequestExcption(VolleyError error) {
        listener.Exception("",error);
    }

    @Override
    public void lockOrUnlockCar(String orderId, String cardId, String carId, boolean lock) {

    }

    @Override
    public void backOrder(String orderId) {

    }
}
